//
//  CTAnnouncementCell.m
//  digitalCurrency
//
//  Created by 默认账户 on 2019/6/3.
//  Copyright © 2019 XinHuoKeJi. All rights reserved.
//

#import "CTAnnouncementCell.h"

@interface CTAnnouncementCell ()
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UIImageView *pattenView;
@property (nonatomic, strong) UIView *lineView;
    
@end

@implementation CTAnnouncementCell

+(instancetype)createTableView:(UITableView *)tableView {
    CTAnnouncementCell *cell = [tableView dequeueReusableCellWithIdentifier:@"announcecell"];
    cell.selectionStyle  = UITableViewCellSelectionStyleNone;
//    cell.backgroundColor = [UIColor blackColor];
    
    [cell makeViews];
    
    return cell;
}

- (void)makeViews {
    [self.contentView addSubview:self.bgView];
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(20);
        make.left.mas_equalTo(12);
        make.right.mas_equalTo(-12);
        make.bottom.mas_equalTo(0);
    }];
    
    [self.bgView addSubview:self.titLabel];
    [self.titLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(20);
        make.left.mas_equalTo(12);
        make.right.mas_equalTo(-80);
        make.height.mas_equalTo(14);
    }];
    __weak typeof(self)weakself = self;
    [self.bgView addSubview:self.contentLabel];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(weakself.titLabel.mas_bottom).offset(15);
        make.left.mas_equalTo(12);
        make.right.mas_equalTo(-12);
        make.bottom.mas_equalTo(-50);
    }];
    
    [self.bgView addSubview:self.pattenView];
    [self.pattenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(5);
        make.width.height.mas_equalTo(66);
        make.right.mas_equalTo(-5);
    }];
    
    [self.bgView addSubview:self.lineView];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(1);
        make.left.mas_equalTo(12);
        make.right.mas_equalTo(-12);
        make.bottom.mas_equalTo(-40);
    }];
    
    [self.bgView addSubview:self.dateLabel];
    [self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(10);
        make.left.mas_equalTo(12);
        make.bottom.mas_equalTo(-15);
    }];
}
    
- (UIView *)bgView {
    if (!_bgView) {
        _bgView = [[UIView alloc] init];
        _bgView.backgroundColor = [UIColor colorWithHEX:mainBlackColor];
        _bgView.layer.masksToBounds = YES;
        _bgView.layer.cornerRadius = 3;
    }
    
    return _bgView;
}

    
- (UILabel *)titLabel {
    if (!_titLabel) {
        _titLabel = [[UILabel alloc] init];
        _titLabel.textColor = [UIColor whiteColor];
        _titLabel.font = [UIFont systemFontOfSize:16];
    }
    
    return _titLabel;
}
    
- (UILabel *)contentLabel {
    if (!_contentLabel) {
        _contentLabel = [[UILabel alloc] init];
        _contentLabel.textColor = [UIColor whiteColor];
        _contentLabel.font = [UIFont systemFontOfSize:14];
        _contentLabel.numberOfLines = 0;
    }
    
    return _contentLabel;
}
    
- (UIImageView *)pattenView {
    if (!_pattenView) {
        _pattenView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@""]];
        _pattenView.layer.cornerRadius  = 33;
        _pattenView.layer.masksToBounds = YES;
    }
    return _pattenView;
}
    
- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.54];
        
    }
    
    return _lineView;
}
    
- (UILabel *)dateLabel {
    if (!_dateLabel) {
        _dateLabel = [[UILabel alloc] init];
        _dateLabel.textColor = [UIColor whiteColor];
        _dateLabel.font = [UIFont systemFontOfSize:12];
        _dateLabel.text = @"12-12";
    }
    return _dateLabel;
}
    
@end
